<?php
session_start();
ob_start();
if (isset($_GET['lang'])) {

    $lang = $_GET['lang'];
} else {
    $lang = 'en';
}
include 'lang/' . $lang . '.php';
if (!isset($_SESSION['loggedin'])) {

    header('Location: login.php');
}
?>
<?php $id = $_GET['ID'];
$id_protected = htmlspecialchars($id);
?>
<?php $id = $_GET['ID'];
$id_protected = htmlspecialchars($id);
?>
<?php include 'index.php';
?>
<div id="body-wrapper">


    <div id="main-content">

        <div class="content-box">

            <?php
            include_once 'connection.php';

            ?>
            <?php
            if (isset($_POST['updateuser'])) {

                $username = $_POST['username'];
                $password = $_POST['password'];



                $query = "update  login set
                    name ='".$username."',
		    password ='".$password."'
		    where id ='".$id_protected."'";


                if (mysql_query($query)) {
                    echo  '
			This User Updated Is Done ..';
                }
                else {
                    echo '
                        This User Update Is Not Done ..';
                }
            }
            ?>

            <div class="content-box-header" id = "addProducts" >

                <h3>Update User</h3>

                <div class="clear"></div>

            </div>

            <div class="content-box-content">

                <div class="tab-content default-tab" id="tab2">

                    <form action="UpdateUsers.php?type=User&ID=<?= $id_protected ?>&lang=<?= $lang?>" method="post" name = "updateuser" enctype="multipart/form-data">

                        <fieldset>

                            <p>
                                <label>Enter New User Name</label>
                                <input class="text-input small-input" type="text" id="small-input" name="username" />
                            </p>

                            <p>
                                <label>Enter New Password</label>
                                <input class="text-input small-input" type="text" id="small-input" name="password" />
                            </p>

                            <p>
                                <input class="button" type="submit" name = "updateuser"  />
                            </p>

                        </fieldset>

                        <div class="clear"></div>

                    </form>
                </div>

            </div> 

        </div> 
    </div>
</div>